package javaAPI.StringJoinerTest;

import java.util.StringJoiner;

public class StringJoinerDemo1 {
    public static void main(String[] args) {
        //StringJoiner sj=new StringJoiner(间隔符号);
        //StringJoiner sj=new StringJoiner(间隔符号，开始符号，结束符号);
        //StringJoiner sj=new StringJoiner(",","[","]");可以快速的实现StringBuilder的拼接过程。
        StringJoiner sj=new StringJoiner("---");
        sj.add("aaa").add("bbb").add("ccc");
        System.out.println(sj);
        System.out.println("========================");
        StringJoiner sj1=new StringJoiner(",","[","]");
        sj1.add("aaa").add("bbb").add("ccc");
        int i=sj1.length();//计算的是sj1中所有字符的个数
        //
        System.out.println(sj1);
        System.out.println(i);

    }
}
